import { createApp } from "vue";

import App from "@/App.vue";
import { setupPinia } from "@/store";
import router, { setupRouter } from "@/router";
import { setupRouterGuard } from "@/router/guard";
import { setupI18n } from "@/locale";

import "@/styles/index.css";

const app = createApp(App);

(async () => {
  // 注册pinia
  setupPinia(app);
  // 注册路由
  setupRouter(app);
  // 注册路由守卫
  setupRouterGuard(router);
  // 等待路由加载完毕
  await router.isReady();
  // 注册i18n
  await setupI18n(app);

  app.mount("#app");
})();
